package com.qing.springbootdispatcherservice.web;

import com.qing.springbootdispatcherservice.service.DispatchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/dispatch")
public class DispatchController {

    @Autowired
    public DispatchService dispatchService;

    //添加订单后，添加调度信息
    @GetMapping("/order")
    public String lock(@RequestParam("orderId") String orderId) throws Exception {
        dispatchService.dispatch(orderId); //将外卖订单分配给小哥
        return "success";
    }
}
